package com.mars.service;

import com.mars.dao.ProductDAO;
import com.mars.po.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductService {

    @Autowired
    private ProductDAO productDAO;

    public List<Product> findAllByPo(Product record){

        return  productDAO.selectByBean(record);

    }

    public List<Product> findAll(){
        return productDAO.selectAll();
    }

    public Product findOne(int id){
        return productDAO.selectByPrimaryKey(id);
    }

    public int  deleteById(int id){
        return productDAO.deleteByPrimaryKey(id);
    }

    public int update(Product record){
        return productDAO.updateByPrimaryKey(record);
    }

    public int insert(Product record){return productDAO.insert(record);}

}
